ValueType

The ValueType method returns a string that specifies the data type of a named value in the registry. You can use this method, for example, to verify the existence and data type of a named value in the registry before calling a method such as Get to retrieve it.

Syntax

ValueType(FullKeyValueName)

Parameters

FullKeyValueName
A string that specifies the named value. This string should consist of a key name followed by a value name. For example, to specify the value MyValue stored in the key HKLM\Software\MyCompany, you would use the following string:

HKLM\Software\MyCompany\MyValue

The key portion of this parameter can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:

\\RemoteMachine\HKLM\Software\MyProg

Return Value

A string that specifies the data type of the named value. If the named value does not exist, an empty string ("") is returned.

Example

The following example demonstrates how to use the ValueType method to confirm the existence of a named value and ensure that it is a supported data type:
<%
Set Reg = Server.CreateObject("IISSample.Registry")
ValueName = "HKLM\Software\MyCompany\MyValue"
 
DataType = ValueType(ValueName)
 
Select Case DataType
    Case "REG_SZ","REG_EXPAND_SZ","REG_DWORD"
        Error = "No Error"
        MyValue = Get(ValueName)
    Case ""
        Error = "Value does not exist"
        MyValue = ""
    Case Else
        Error = "Unsupported value type."
        MyValue = ""
End Select
 
If Error = "No Error" Then
    'Use the value to perform operations
    . . .
Else
    'Handle the error
    . . . 
End If 
 
%>
 

Applies To

Registry Access Component

See Also

Get, GetExpand, KeyExists